package org.huatek.anders.utils.jwt;

import com.fasterxml.jackson.databind.ObjectMapper;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author anders
 * @date 2018-12-04 13:16
 **/
public class JwtResponse {
    public static void toJson(HttpServletResponse response, Object object) {
        try {
            ObjectMapper mapper = new ObjectMapper();
            response.setContentType("application/json;charset=utf-8");
            response.getWriter().write(mapper.writeValueAsString(object));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
